Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: various debug fixes and VS Code compatibility enhancements #11984

Merged
merged 16 commits into from
Jan 24, 2023

Conversation

kittaakos
Copy link
Contributor

@kittaakos kittaakos commented Dec 13, 2022

What it does

Closes #11871
Closes #11879
Closes #11885
Closes #11886
Closes #11916
Closes #11880

How to test

debug_001.mp4
  • Set a breakpoint before any variable declarations (line 17) and after (line 28). You can use other lines too. Continue the debugger. It hits the breakpoint. (#11885). You see no local variable. Continue the debugger. It hits the next breakpoint when there are variables. It's visible from the Variables view. Right-click the variable, and you will see the debugType and debugState dependent content menu from the VSIX. Click on it. It works. You also see two additional debug toolbar items—one with the ❤️ codicon and the other with text. Click on them, and both work. (#11871)
debug_002.mp4

For reviewers:

This 👆 requires a more complex setup and another VSIX (marus25.cortex-debug-1.5.1.vsix from https://downloads.arduino.cc/marus25.cortex-debug/marus25.cortex-debug-1.5.1.vsix). The fix cannot be verified with the mock-debug extension. Also, I used a physical board (Arduino Zero) where the code runs. The code runs on the device, and the debugger talks to it via dgb. I am happy to provide the steps to set up the toolchain, but the board is needed. Let me know it's required.

Review checklist

Reminder for reviewers

@kittaakos kittaakos force-pushed the #11871 branch 3 times, most recently from 15fdf2a to 90f99b0 Compare December 13, 2022 16:45
@kittaakos kittaakos marked this pull request as ready for review December 13, 2022 16:47
@vince-fugnitto vince-fugnitto added vscode issues related to VSCode compatibility debug issues that related to debug functionality labels Dec 14, 2022
@kittaakos
Copy link
Contributor Author

Hi, is there any update on this PR? Can somebody please help with the review? Thank you!

Akos Kitta added 3 commits January 17, 2023 09:40
 - feat: added support for `debug/toolbar` and `debug/variables/context`,
 - feat: added support for `debugState` when context (eclipse-theia#11871),
 - feat: can customize debug session timeout, and error handling (eclipse-theia#11879),
 - fix: the `debugType` context that is not updated,
 - fix: `configure` must happen after receiving capabilities (eclipse-theia#11886),
 - fix: added missing conext menu in the _Variables_ view,
 - fix: handle `setFunctionBreakboints` response with no `body` (eclipse-theia#11885),
 - fix: `DebugExt` fires `didStart` event on `didCreate` (eclipse-theia#11916),
 - fix: validate editor selection based on the text model (eclipse-theia#11880)

Closes eclipse-theia#11871
Closes eclipse-theia#11879
Closes eclipse-theia#11885
Closes eclipse-theia#11886
Closes eclipse-theia#11916
Closes eclipse-theia#11880

Signed-off-by: Akos Kitta <[email protected]>
@kittaakos
Copy link
Contributor Author

@marcdumais-work and @JonasHelming, could you please help move this PR forward? We at Arduino would like to get these fixes in Theia. Could you tell me the procedure for contacting other interested parties in the verification? Something like the community did here: #10333. Thank you!

@vince-fugnitto
Copy link
Member

Press F5, readme.md opens, and the top stack frame is the first line of the readme file. Check the DevTools console; there is no Error: Illegal value for lineNumber. (#11880)

In my case (Ubuntu) pressing F5 will trigger the error in the devConsole, is it expected?

image

Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First reading of the code with some suggestions and questions.

packages/debug/src/browser/debug-session-connection.ts Outdated Show resolved Hide resolved
packages/debug/src/browser/debug-session.tsx Show resolved Hide resolved
packages/debug/src/browser/debug-session.tsx Outdated Show resolved Hide resolved
packages/debug/src/browser/debug-session.tsx Outdated Show resolved Hide resolved
packages/debug/src/browser/debug-session.tsx Show resolved Hide resolved
/**
* Invoked when sending the `terminate` request to the debugger is rejected or timed out.
*/
protected handleTerminateError(err: unknown): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces new API, and I don't really see why. What's the use case?

Copy link
Contributor Author

@kittaakos kittaakos Jan 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will help downstream to customize the error handling without overriding the entire stop method and copy-pasting code from Theia to downstream. This generally simplifies the Theia version bumps for extenders.

What's the use case?

I can add dummy customization to the api-samples extension.

packages/debug/src/browser/view/debug-toolbar-widget.tsx Outdated Show resolved Hide resolved
packages/editor/src/browser/editor.ts Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@kittaakos
Copy link
Contributor Author

Thank you!

In my case (Ubuntu) pressing F5 will trigger the error in the devConsole, is it expected?

No. It does not. I see that the vscode-mock-debug sends 0 for the column although columnsStartAt1 is true. These checks will always be false, as the Position properties must be unsigned integers:

https://github.com/kittaakos/theia/blob/76f93cb0d9c2e7e79d5dc943094bc2c8a0eff027/packages/editor/src/browser/editor-manager.ts#L256-L257

For the time being, I have opened an issue and will provide a workaround against the negative integer properties: microsoft/vscode-mock-debug#85.

Signed-off-by: Akos Kitta <[email protected]>
@colin-grant-work colin-grant-work removed their request for review January 18, 2023 10:38
@kittaakos
Copy link
Contributor Author

Thanks a lot for the help! I pushed some changes based on the API review and also added a workaround for the Illegal value for lineNumber error mentioned in #11984 (comment).

The collection of contributed commands was written in a convoluted way,
this commit makes it more straightforward with just 2 loops.
The ternary implementation is stricly equivalent to the `Math.max`
function, so use that instead.
Assigning a default option object to set default values is problematic
as said default values will be discarded if any option object is passed.

Instead default values must be handled in conjuction of whatever options
are passed to functions.
Copy link
Member

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code now LGTM after some rewrites, changes work as described.

@kittaakos
Copy link
Contributor Author

Code now LGTM after some rewrites

:) Thanks for the help

@kittaakos
Copy link
Contributor Author

@thegecko, would you be interested in checking if this PR does not break anything with your debug adapter as you did here: #10333 (review). Thank you!

@thegecko
Copy link
Member

@thegecko, would you be interested in checking if this PR does not break anything with your debug adapter as you did here: #10333 (review). Thank you!

I can

@thegecko thegecko self-requested a review January 19, 2023 16:20
@thegecko
Copy link
Member

OK, browser-based debug has been broken in the latest (1.33.0 release). I need to investigate this before checking your PR.

Copy link
Member

@thegecko thegecko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested this changeset hasn't broken Arm's browser debugger, but haven't tested the additional functionality.

@thegecko
Copy link
Member

By the way @kittaakos please reach out if you want any information with testing the browser-based arm debugger yourself:

https://open-vsx.org/extension/arm/embedded-debug

@tsmaeder
Copy link
Contributor

@thegecko would it be possible to design some tests that would break when we break front end debugging? Or are the breakages to diverse?

@thegecko
Copy link
Member

thegecko would it be possible to design some tests that would break when we break front end debugging? Or are the breakages to diverse?

I was thinking about this. One key thing which often breaks browser debugging is accidental inclusion of node libraries. I'd hope we can mitigate that at build time with the correct webpack configs.

I wonder if a simple inline debug adapter test harness could be created (perhaps based on mock-debug) which could be used to test the UI in browser mode?

@msujew
Copy link
Member

msujew commented Jan 24, 2023

@paul-marechal Do you plan on merging this before the release?

@paul-marechal
Copy link
Member

@msujew I was waiting on @thegecko to confirm this change doesn't make things worse for their use cases, LGTM now.

@paul-marechal paul-marechal merged commit 678e335 into eclipse-theia:master Jan 24, 2023
@vince-fugnitto vince-fugnitto added this to the 1.34.0 milestone Jan 26, 2023
kittaakos pushed a commit to kittaakos/arduino-ide that referenced this pull request Mar 22, 2023
 - revert debug feature patching (eclipse-theia/theia#11984)
 - revert menu ordering hack (eclipse-theia/theia#8377)

Signed-off-by: Akos Kitta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug issues that related to debug functionality vscode issues related to VSCode compatibility
Projects
None yet
7 participants